{% extends 'vcs/base.html' %}

{% block title %}Repository: {{ r }}{% endblock %}

{% block css %}
table.commit-list .branch { width: 20%; }
table.commit-list .identifier { width: 20%; }
table.commit-list .timestamp { width: 20%; }
table.commit-list .message { width: 40%; }
{% endblock %}

{% block breadcrumbs %}
<li><a href="/vcs/">repositories</a> &raquo;</li>
<li class="repository current">{{ r }}</li>
{% endblock %}

{% block content %}

<h2>Active Branches</h2>
{% if r.active_branches.count %}
<ul>
    {% for b in r.active_branches.all %}
    <li><a href="{{ b.get_absolute_url }}">{{ b }}</a><br />
    {{ b.commits.count }} commit{{ b.commits.count|pluralize }}
    </li>
        
    {% endfor %}
</ul>
{% endif %}

<h2>Recent Commits</h2>
{% if r.commits.count %}
<table width="100%" cellspacing="0" cellpadding="0" class="commit-list">
    <tr>
        <th class="branch">Branch</th>
        <th class="identifier">Identifier</th>
        <th class="timestamp">Timestamp</th>
        <th class="message">Message</th>
    </tr>
    {% for c in r.commits.all %}
    <tr>
        <td class="branch">
            {% for b in c.branches.all %}
            <a href="{{ b.get_absolute_url }}">{{ b }}</a>{% if not forloop.last %},{% endif %}
            {% endfor %}
        </td>
        <td class="identifier">
            <a href="{{ c.get_absolute_url }}">{{ c }}</a>
        </td>
        <td class="timestamp">
            {{ c.commit_timestamp|date:"Y.m.d H:i:s" }}{% ifnotequal c.author_timestamp c.commit_timestamp %}<br />
            <span>(commit written at {{ c.author_timestamp|date:"Y.m.d H:i" }})</span>{% endifnotequal %}
        </td>
        <td class="message">
            {{ c.message|linebreaksbr }}
        </td>
    </tr>
    {% endfor %}
</table>
{% endif %}


{% if r.inactive_branches.count %}
<div style="height: 50px;"></div>

<h2>Inactive Branches</h2>
<ul>
    {% for b in r.inactive_branches.all %}
    <li><a href="{{ b.get_absolute_url }}">{{ b }}</a><br />
    {{ b.commits.count }} commit{{ b.commits.count|pluralize }}
    </li>
        
    {% endfor %}
</ul>
{% endif %}


{% endblock %}
